package com.example.park2212.points

import android.graphics.Color
import android.widget.TextView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.example.lib_base.entity.PointsBeanItem
import com.example.lib_base.entity.PointsBeanItemItem
import com.example.park2212.R

class PointsAdapter:BaseQuickAdapter<PointsBeanItemItem,BaseViewHolder>(R.layout.item_tasks) {
    override fun convert(helper: BaseViewHolder, item: PointsBeanItemItem) {
        helper.setText(R.id.tasks_name,item.pointName)
        helper.setText(R.id.tasks_address,"点位位置：${item.pointLocation}")
        helper.setText(R.id.tasks_status,item.patrolType)

        val tv_status = helper.getView<TextView>(R.id.tasks_status)
        if (item.patrolType == "安防巡检"){
            tv_status.setTextColor(Color.BLUE)
            tv_status.setBackgroundResource(R.drawable.shape_solid_orange)
        }else if (item.patrolType == "保洁巡检"){
            tv_status.setTextColor(Color.GREEN)
            tv_status.setBackgroundResource(R.drawable.shape_solid_darkgreen)
        }else if (item.patrolType == "日常巡检"){
            tv_status.setTextColor(Color.YELLOW)
            tv_status.setBackgroundResource(R.drawable.shape_zhanyong)
        }else if (item.patrolType == "家居巡检"){
            tv_status.setTextColor(Color.RED)
            tv_status.setBackgroundResource(R.drawable.shape_weihu)
        }
    }
}